package org.kamionowski.supreme.services.crawler.impl;

import org.kamionowski.supreme.persistence.entity.Service;
import org.springframework.beans.factory.annotation.Required;

import javax.inject.Inject;

/**
 * Created by IntelliJ IDEA.
 * User: Marcin Kamionowski
 * Date: 10.04.11
 * Time: 20:09
 */
public class CrawlerAnalyzerListener extends CrawlerStateAdapter{

    @Inject
    private CrawlerAnalyzer crawlerAnalyzer;

    @Override
    public void fileDetected(RemoteFile file) {
        crawlerAnalyzer.analyzeFile(file);
    }

    @Override
    public void begin(Service service) {
        crawlerAnalyzer.preProcessing(service);
    }

    @Override
    public void end(Service service) {
        crawlerAnalyzer.postProcessing(service);
    }

    @Required
    public void setCrawlerAnalyzer(CrawlerAnalyzer crawlerAnalyzer) {
        this.crawlerAnalyzer = crawlerAnalyzer;
    }
}
